package com.fieldchain.ex.fa100.utils.chart.dataset;

import android.graphics.Color;
import android.graphics.Paint;

import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.CandleDataSet;
import com.github.mikephil.charting.data.CandleEntry;

import java.util.List;

/**
 * Created by biyunlong
 * Email: 1225198434@qq.com
 * Data:  2018/10/12
 */
public class MyCandleDataSet extends CandleDataSet {
    public MyCandleDataSet(List<CandleEntry> yVals, String label) {
        super(yVals, label);
        init();
    }

    public void init() {
        int red = Color.parseColor("#FF0000");
        int green = Color.parseColor("#66CD00");
        setAxisDependency(YAxis.AxisDependency.LEFT);

        setIncreasingColor(red);//上涨为红色
        setIncreasingPaintStyle(Paint.Style.FILL);
        setDecreasingColor(green);//下跌为绿色
        setDecreasingPaintStyle(Paint.Style.FILL );
        setNeutralColor(red);
        setShadowColorSameAsCandle(true);
        setDrawValues(false);
        setShadowWidth(0.7f);
        setHighlightLineWidth(1f);
        setHighlightEnabled(false);
        setHighLightColor(Color.parseColor("#ffffff"));
        setValueTextSize(6);
    }
}
